<!---
Copyright: (c) 2006 The MachBlog Authors
Authors: Matt Woodward (mpwoodward@gmail.com) & Peter J. Farrell (pjf@maestropublishing.com)

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. 
You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software 
distributed under the License is distributed on an "AS IS" BASIS, 
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
See the License for the specific language governing permissions and 
limitations under the License.

$Id: ResourceBundleFacade.cfc 1194 2007-07-18 04:54:47Z pfarrell $

Notes:
--->
<cfcomponent
	displayname="ResourceBundleFacade"
	output="false"
	hint="ResourceBundleFacade component for MachBlog.">
	
	<!---
	PROPERTIES
	--->
	<cfproperty name="resourceBundle" type="org.hastings.locale.ResourceBundle" required="false" />
	<cfproperty name="localeUtils" type="org.hastings.locale.utils" required="false" />
	
	<!---
	INITIALIZATION / CONFIGURATION
	--->
	<cffunction name="init" access="public" output="false" returntype="ResourceBundleFacade" 
			hint="Constructor for this CFC.">
 		<cfreturn this />
	</cffunction>

	<!---
	ACCESSORS
	--->	
	<cffunction name="setResourceBundle" access="public" output="false" returntype="void">
		<cfargument name="resourceBundle" type="org.hastings.locale.ResourceBundle" required="true" />
		<cfset application.resourceBundle = arguments.resourceBundle />
	</cffunction>
	<cffunction name="getResourceBundle" access="public" output="false" returntype="org.hastings.locale.ResourceBundle">
		<cfreturn application.resourceBundle />
	</cffunction>
	
	<cffunction name="setLocaleUtils" access="public" output="false" returntype="void">
		<cfargument name="localeUtils" type="org.hastings.locale.utils" required="true" />
		<cfset application.localeUtils = arguments.localeUtils />
	</cffunction>
	<cffunction name="getLocaleUtils" access="public" output="false" returntype="org.hastings.locale.utils">
		<cfreturn application.localeUtils />
	</cffunction>

	<!---
	PUBLIC FUNCTIONS
	--->
	<cffunction name="resourceBundleExists" access="public" output="false" returntype="boolean" 
		hint="Returns a boolean indicating whether or not there is a resourceBundle in the application scope.">
		
		<cfset var rbExists = false />
		
		<cfif StructKeyExists(application, "resourceBundle")>
			<cfset rbExists = true />
		</cfif>
		
		<cfreturn rbExists />
	</cffunction>
	
</cfcomponent>